package com.ygk.bluepath.member.View;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.ygk.bluepath.R;
import com.ygk.bluepath.core.BActivity;
import com.ygk.bluepath.member.Presenter.LoginPresenter;

import org.json.JSONObject;

import utils.PhoneInformationUtil;

/**
 * Created by USER on 2016/7/7.
 */
public class LoginActivity extends BActivity implements View.OnClickListener,LoginView{

    @ViewInject(R.id.et_name)
    private EditText et_name;
    @ViewInject(R.id.et_password)
    private EditText et_Password;
    @ViewInject(R.id.bt_login)
    private Button bt_login;

    private LoginPresenter mPresenter;

    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        setContentView(R.layout.activity_login);
        ViewUtils.inject(this);
        init();
    }

    private void init() {

        mPresenter=new LoginPresenter(this,this);

        bt_login.setOnClickListener(this);

    }
    @Override
    public void onClick(View v) {


        switch (v.getId()){
            case R.id.bt_login:

                JSONObject json=new JSONObject();

                bMap.put("mobile",et_name.getText().toString());
                bMap.put("password",et_Password.getText().toString());
                bMap.put("plat_form","3");
                bMap.put("app_version", PhoneInformationUtil.getVersionName());
                bMap.put("device_token", sp.getDeviceToken());
                mPresenter.doPost("member/login",bMap,true,true,"login","");

                break;
        }


    }




}
